//
//  main.c
//  C_3 创建小工具
//
//  Created by Robin on 16/3/16.
//  Copyright © 2016年 cnbm. All rights reserved.
//

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, const char * argv[]) {
    
    char line[80];
    
    FILE *file_read = fopen("spooy.csv", "r");
    
    FILE *file0 = fopen("ufo.csv", "w");
    FILE *file1 = fopen("disapperance.csv", "w");
    FILE *file2 = fopen("other.csv", "w");
    
    while (fscanf(file_read, "%79[^\r\n]\n",line) == 1) { // 要记得有错误检查
        if (strstr(line, "UFO")) {
            fprintf(file0, "%s\n",line);
        }else if (strstr(line, "Disappearance")){
            fprintf(file1, "%s\n",line);
        }else
            fprintf(file2, "%s\n",line);
    }
    
    fclose(file0);
    fclose(file1);
    fclose(file2);
    
    
    
    return 0;
}
